
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico"> 
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
      
    </style>
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">日报白名单管理</h2>
    </div>
    <table class="table table-bordered bud_hei">
        <tr> 
            <td colspan="5"><a href="javascript:;" class="btn btn-sm btn-info" id="addstuff">新增免填职员</a></td>
          </tr>
          <tr>
            <td style="width: 120px;min-width: 120px" class="text-center">所属部门：</td>
            <td><input type="text" name="" class="form-control" id=""></td>
             <td style="width: 120px;min-width: 120px" class="text-center">职员姓名：</td>
            <td><input type="text" name="" class="form-control" id=""></td>
            <td><button class="btn btn-sm btn-info" type="button">查询</button><span class="lr_5"></span><button class="btn-info btn-sm btn">清空查询条件</button></td>
          </tr>
    </table>
    <!-- 标题 -->
    <div class="row-margin-top">
    <form action=""  class="form-inline">
      <table class="table table-striped table-bordered table-hover bud_hei text-center" id="verifytable">
      	  <tr>
			    <th colspan="5"><button class="btn-info btn btn-sm" type="button" id="checkAll1">全选</button><span class="lr_5"></span><button class="btn-danger btn btn-sm" type="button" id="del_this">删除</button></th>
      	 </tr>
          <tr class="info">
            <td style="vertical-align: middle !important;text-align: center;width: 3%">
              <!-- <input type="checkbox" name="items" id="checkAll"> -->
            </td>
            <td class="text-center">No.</td>
            <td class="text-center">所属部门</td>
            <td class="text-center">职员姓名</td>
            <td class="text-center">操作</td>
          </tr>
              <tr>
              		<td align="center"><input type="checkbox" name="items"></td>
                    <td>1</td>
                    <td>财务部</td>
                    <td>唐海燕</td>
                    <td><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
              <tr>
              		<td align="center"><input type="checkbox" name="items"></td>
                    <td>2</td>
                    <td>财务部</td>
                    <td>唐海燕</td>
                    <td><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
               <tr>
               		<td align="center"><input type="checkbox" name="items"></td>
                    <td>3</td>
                    <td>财务部</td>
                    <td>唐海燕</td>
                    <td><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
      </table>
         <h5 class="text-center"  style="font-size: 13px;font-weight: 500">
                    总共有12条记录，第1/2页,当前页<input id="page" type="text"  style="width: 40px" value="1"/><span id="gopage">Go</span>&nbsp;&nbsp;<span id="fistpage">首页</span>&nbsp;&nbsp;
                    每页显示
                    <select id="pagesize">
                        <option value='10' selected>10条</option>
                        <option value='15'>15条</option>
                        <option value='20'>20条</option>

                    </select>
                </h5>
    
      <!--   <h3 class="text-center">对不起没有查询到符合条件的信息</h3> -->
     
</form>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <!--统计代码，可删除-->
    <!-- <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
     <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
     <script src="__STATIC__/layout/js/common.js"></script>
     <script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
    <script>

      
        $(document).ready(function(){
            // $("#verifytable tbody tr td").find('.duigou')
          /*格式化数字金额*/
          var $ObjectNum =$(".ObjectNum");
             toNum($ObjectNum);
          /*为已生效的核销申请字体加粗*/
            var $duigou =$(".duigou");
             $duigou.parent().addClass("font-bold");

/*删除*/
        $("#del_this").click(function() {
            // $("#alert_addNewZone").show();
            var $items = $("[name=items]:checkbox")
            var $is_verify=$(".is_verify");
            if ($items.filter(':checked').length < 1) {
                sweetAlert("", "请至少选择一条要删除的白名单！", "error");
            } else {
              $items.each(function(){ 
              	if( $(this).is(':checked')){
              		 $(this).parent().parent().remove();
              		}
				}); 
            }
        });

/*全选*/

$("#checkAll1").click(function(){
   $("[name=items]:checkbox").prop("checked", true);
    $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#f8f800")
})
/*反选*/

$("#no_checkAll").click(function(){
   $("[name=items]:checkbox").prop("checked", false);
    $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#fff")
})
          /*table表格操作*/
      $("#checkAll").click(function() {

            $("[name=items]:checkbox").prop("checked", $(this).prop("checked"));
            if ($("[name=items]:checkbox").prop("checked") != true) {
                // console.log($(this))
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#fff")
            } else {
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#f8f800")

            }
        })
        $("[name=items]:checkbox").click(function() {
            //定义一个临时变量，避免重复使用同一个选择器选择页面中的元素，提高程序效率
            // console.log(1)
            var $tmp = $("[name=items]:checkbox");
            if ($(this).prop("checked") != true) {
                // console.log($(this))
                $(this).parent().parent().css("backgroundColor", "#fff")
            } else {
                $(this).parent().parent().css("backgroundColor", "#f8f800")

            }
            //用filter()方法筛选出选中的复选框，并直接给CheckedAll赋值
            $("#checkAll").prop('checked', $tmp.length == $tmp.filter(':checked').length);

          })
        })
   /*新增*/ 
   $("#addstuff").click(function(){
        //iframe层-父子操作
            layer.open({
                type: 1,
                title: '添加白名单',
                 area: ['700px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                content: '<form class="form-inline" style="padding:10px"><table class="row-margin-top table table-bordered"><tr><td>职员:</td><td> <div class="col-xs-4"><div class="input-group" id="jxs_input" style=""><input type="text" placeholder="请输入关键字或空格查询" class="form-control inputremindPeple" id="remainMan" name="jxs_id" value=""><div class="input-group-btn"><ul class="dropdown-menu dropdown-menu-right" role="menu"></ul></div></div><div id="jxs_queding" class="selectedOnlyOne" style="display:none"><span class="inin"></span><span class="close">×</span></div></div><div class="col-xs-2"><input type="button" class="btn btn-primary btn-sm" id="select" value="选择"/></div></td></tr><tr><td>已选职员：</td><td></td></tr></table><div class="padding-10 text-center"><button class="btn-sm btn btn-success" type="button">确定</button></div></form>'
            });
            return false

   })  

            $("#remainMan").bsSuggest({
            url: "{:url('select/jxsjson')}",
            /*effectiveFields: ["userName", "shortAccount"],
             searchFields: [ "shortAccount"],*/
            effectiveFieldsAlias:{title: "名称"},
            ignorecase: true,
            showHeader: true,
            showBtn: false,     //不显示下拉按钮
            delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
            idField: "id",
            keyField: "title",
            clearable: true
        }).on('onDataRequestSuccess', function (e, result) {
            console.log('onDataRequestSuccess: ', result);
        }).on('onSetSelectValue', function (e, keyword, data) {
            $('#jxs_queding').find('.inin').html(keyword.key)
            $('#jxs_queding').show()
            $('#jxs_input').hide()
            $('#jxs_input').find('input').val(keyword.id)
            //console.log('onSetSelectValue: ', keyword, data);


            $("#remainMan2").bsSuggest('destroy')
            var catbs = $("#remainMan2").bsSuggest({
                url: "{:url('select/netjson')}?keyword="+keyword.id,
                effectiveFieldsAlias:{title: "名称"},
                ignorecase: true,
                showHeader: true,
                showBtn: false,     //不显示下拉按钮
                delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                idField: "id",
                keyField: "title",
                clearable: true
            });

            //网点名称
            $("#remainMan2").bsSuggest('enable')
            catbs.on('onSetSelectValue', function (e, keyword, data) {
                $('#jxs_queding2').find('.inin').html(keyword.key)
                $('#jxs_queding2').show()
                $('#jxs_input2').hide()
                $('#jxs_input2').find('input').val(keyword.id)


                //产品名称
                $("#categoryName").bsSuggest('destroy')
                $("#categoryName").bsSuggest({
//                url: "{:url('select/product')}?keyword="+keyword.id,
                    url: "{:url('select/product')}",
                    effectiveFieldsAlias:{title: "名称"},
                    ignorecase: true,
                    showHeader: true,
                    showBtn: false,     //不显示下拉按钮
                    delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                    idField: "id",
                    keyField: "title",
                    clearable: true
                }).on('onSetSelectValue', function (e, keyword, data) {
                    $(this).val('')
                    var bool = false
                    $('#renyuan2 .ren').each(function (idx,o) {
                        if($(this).data('id') == keyword.id){
                            bool = true;
                        }
                    })
                    if(bool == false){
                        $('#renyuan2').append('<span class="ren" data-id="'+keyword.id+'">'+keyword.key+'<span class="close">×</span></span>')

                        var jxs_id = $('#remainMan').val()
                        var net_id = $('#remainMan2').val()

                        //ajax搜索产品相关信息
                        $.post('{:url("search_product_by_id")}',{id:keyword.id,jxs_id:jxs_id,net_id:net_id},function (data) {
                            $('#table1 tbody').append(data)
                        })

                    }
                });
                $("#categoryName").bsSuggest('enable')
            });
        }).on('onUnsetSelectValue', function () {
            console.log("onUnsetSelectValue");
        });

        //关闭经销商选择
        $('#jxs_queding .close').click(function () {
            $(this).closest('#jxs_queding').hide().find('.inin').html('')
            $('#jxs_input').show().find('input').val('')

        })
   $(document).on("click",".del_this",function() {
      
                swal({
                            title: "提示",
                            text: "您真的要删除么？",
                            type: "warning",
                            showCancelButton: true,
                            confirmButtonColor: "#FF3333",
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            closeOnConfirm: true
                        })
                        // function (isConfirm) {
                        //   if (isConfirm) {
                        //    //alert(cid);
                        //     $.post("{:url('Productsseries/dropser')}",{sid:sid},function(re){
                        //       //alert(re);
                        //         if(re==1){
                        //             swal({
                        //             title: "完成",
                        //             text:  "系列已删除",
                        //             type: "success"
                        //             },function(){
                        //                 location.href='{:url("Productsseries/series")}';
                                        
                        //             });
                        //         }else{
                        //              swal({
                        //             title: "错误",
                        //             text:  "系统繁忙请稍后再试",
                        //             type: "warning"
                        //             });
                        //         }
                        //     })
                        // }
                        // })
        });
    </script>
</body>

</html>
